<template>
	<view class="query-chat" @tap="send">
		<view class="query-chat--left">
			<slot name="icon"></slot>
			<text class="iconfont" :class="left" :style="{color:iconColor}" v-if="left!=''"></text>
			<text>{{title}}</text>
		</view>
		<text class="iconfont icon-youjiantou" v-if="right=='arrow'"></text>
		<switch @change="emits('change')" :checked="switch" style="transform:scale(.7)" v-if="right=='switch'"/>
	</view>
</template>

<script setup>
	const props = defineProps({
		right:{
			type:String,
			default:""
		},
		switch:{
			type:Boolean,
			default:false
		},
		title:{
			type:String,
			required:true
		},
		left:{
			type:String,
			default:""
		},
		iconColor:{
			type:String,
			default:""
		}
	})
	const emits = defineEmits(["submit","change"])
	/**
	 * 是否跳转删除
	 */
	function send(){
		if(props.right=="switch")return;
		emits("submit")
	}
	
</script>

<style lang="scss" scoped>
	.query-chat{
		padding: 27upx 20upx;
		border-bottom: 1upx solid #f4f4f4;
		background-color: white;
		margin: 20upx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 30upx;
		.iconfont{
			font-size: 40upx;
			color: #CCC;
		}
		&--left{
			display: flex;
			align-items: center;
			gap: 30upx;
		}
	}
</style>